package com.flying.invest.account.service;

import java.util.Date;

import com.flying.common.annotation.DaoCreate;
import com.flying.common.annotation.DaoQuery;
import com.flying.common.annotation.DaoRemove;
import com.flying.common.annotation.DaoUpdate;
import com.flying.common.util.Codes;
import com.flying.framework.annotation.MethodInfo;
import com.flying.framework.annotation.Param;
import com.flying.framework.annotation.Service;
import com.flying.framework.model.ActionResult;
import com.flying.framework.model.QueryResult;
import com.flying.framework.service.AbstractService;
import com.flying.invest.account.model.AccountFlow;
import com.flying.invest.invest.TransactionType;

@Service(value="AccountFlowService", desc="")
public class AccountFlowService extends AbstractService{
        
	@MethodInfo("新增")
	@DaoCreate(entity=AccountFlow.ENTITY_NAME)
	public AccountFlow create(
		
			@Param(value=AccountFlow.USER_ID, required=true,	desc="所属用户") Long user_id,
			@Param(value=AccountFlow.ACCOUNT_ID, required=true,	desc="账户ID") Long account_id,
			@Param(value=AccountFlow.AMOUNT, required=true,	desc="发生金额") Double amount,
			@Param(value=AccountFlow.TRANSACTION_TYPE, required=true, enumClass=TransactionType.class,	desc="交易类型") Integer transaction_type,
			@Param(value=AccountFlow.TRANSACTION_TIME, required=true,	desc="交易时间") Date transaction_time,
			@Param(value=AccountFlow.TRANSACTION_ID, required=false,	desc="交易时间") Long transaction_id,
			@Param(value=AccountFlow.REMARKS, required=false,	desc="说明") String remarks,
			@Param(value=AccountFlow.CREATE_TIME, required=false,	desc="创建时间") Date create_time
		
		) throws Exception {
		
		return null;
	}

	@MethodInfo("修改")
	@DaoUpdate(entity=AccountFlow.ENTITY_NAME)
	public ActionResult update(
		
			@Param(value=AccountFlow.FLOW_ID, required=true,	desc="FLOW ID") Long flow_id,
			@Param(value=AccountFlow.USER_ID, required=true,	desc="所属用户") Long user_id,
			@Param(value=AccountFlow.ACCOUNT_ID, required=true,	desc="账户ID") Long account_id,
			@Param(value=AccountFlow.AMOUNT, required=true,	desc="发生金额") Double amount,
			@Param(value=AccountFlow.TRANSACTION_TYPE, required=true, enumClass=TransactionType.class,	desc="交易类型") Integer transaction_type,
			@Param(value=AccountFlow.TRANSACTION_TIME, required=true,	desc="交易时间") Date transaction_time,
			@Param(value=AccountFlow.CREATE_TIME, required=false,	desc="创建时间") Date create_time
			
		) throws Exception {
		
		return null;
	}

	@MethodInfo("删除")
	@DaoRemove(entity=AccountFlow.ENTITY_NAME)
	public ActionResult remove(
		
			@Param(value=AccountFlow.FLOW_ID, required=true,	desc="FLOW ID") Long flow_id
		
		) throws Exception {
		
		return null;
	}

	@MethodInfo("搜索")
	@DaoQuery(entity=AccountFlow.ENTITY_NAME, pageable=true, modelClass=AccountFlow.class, osql="ORDER BY transaction_time DESC")
	public QueryResult<AccountFlow> findAll(
			@Param(value=AccountFlow.ACCOUNT_ID, required=true,	desc="账户ID") Long account_id,
			@Param(value=AccountFlow.TRANSACTION_TYPE, required=false, enumClass=TransactionType.class,	desc="交易类型") Integer transaction_type,
			@Param(value=Codes.PAGE_NUM, 	required=false, desc="分页页号，默认0") int page,
			@Param(value=Codes.PAGE_SIZE, 	required=false, desc="分页大小，默认10") int rows) throws Exception {
		return null;
	}

	@MethodInfo("查询")
	@DaoQuery(entity=AccountFlow.ENTITY_NAME, single=true, throwsNotFoundException=true )
	public AccountFlow findById(
		
			@Param(value=AccountFlow.FLOW_ID, required=true,	desc="FLOW ID") Long flow_id
		) throws Exception {
		return null;
	}

}